package com.dungnt.vtime.countdown;

import com.dungnt.vtime.utils.Utils;

import android.os.CountDownTimer;
import android.view.View;
import android.widget.TextView;

public class VTCountDownTimer extends CountDownTimer {
	public long getRemainMilli() {
		return remainMilli;
	}

	public void setRemainMilli(long remainMilli) {
		this.remainMilli = remainMilli;
	}

	private View v;
	VTCountDownItem c;
	long secs, mins, hrs, msecs;
	String minutes, seconds, hours, milliseconds;
	private long remainMilli;

	public VTCountDownTimer(VTCountDownItem c, long countDownInterval, View v) {
		super(c.toMiliseconds(), countDownInterval);
		this.c = c;
		this.v = v;
	}

	public VTCountDownTimer(long millisInFuture, long countDownInterval) {
		super(millisInFuture, countDownInterval);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void onFinish() {
		// TODO Auto-generated method stub
		((TextView) v).setText("DONE");
		remainMilli = 0;
	}

	@Override
	public void onTick(long millisUntilFinished) {
		// TODO Auto-generated method stub
		remainMilli = millisUntilFinished;
		String time = Utils.updateTimer(millisUntilFinished, true);
		((TextView) v).setText(time);

	}

	public View getV() {
		return v;
	}

	public void setV(View v) {
		this.v = v;
	}

	public void pause() {

	}

	public void resume() {
	}

}
